package com.hxgz.steel.dao;

import com.hxgz.steel.domain.Order;
import com.hxgz.steel.dto.*;
import com.hxgz.steel.dto.OrderDto;
import com.hxgz.steel.dto.SellerOrderDto;
import com.hxgz.steel.dto.SellerOrderInfoDto;

import javax.persistence.Id;

import io.swagger.annotations.ApiParam;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.*;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import java.util.List;
import java.util.Map;

@Component("OrderMapper")
public interface OrderMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Order record);

    int insertSelective(Order record);

    Order selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);

    List<OrderDto> getOrderListByZero(HashMap<Object, Object> map);

    List<OrderDto> getOrderListByOne(HashMap<Object, Object> map);

    List<SellerOrderDto> getListsByStatusAndTime(Map map);

    List<SellerOrderDto> getListByTimeAndStatus(Map map);

    Integer getdealNumberByDayByNotCancelledAndNotWaitingPaymentAndClosed(Long id);

    Integer getDealNumberByNotCancelledAndNotWaitingPaymentAndClosed(Long id);

    List<SellerRankListDto> merchantRankList();

    Integer getAllOrderNumByNotCancelledAndNotWaitingPaymentAndClosed();

    Integer getDealOrderByDayByNotCancelledAndNotWaitingPaymentAndClosed();

    BigDecimal getAllMoneyByDoneAndDoneDelete();

    BigDecimal getMoneyByDoneAndDoneDelete();


    //SellerOrderInfoDto getById(Long id, Long userId);
    SellerOrderInfoDto getById(@Param("id") Long id, @Param("userId") Long userId);

    int getTodayCount(Long userId);

    BigDecimal getDayVolume(Long userId);

    int getTotleCount(Long userId);

    BigDecimal getTotleVolume(Long userId);

    List<BigDecimal> getCountByMonth(Long userId);

    List<CountDto> getList(Map<String, Object> map);

    Order selectByUserIdAndOrderNo(@Param("orderNo") String orderNo, @Param("userId") Long userId);

    Order selectByOrderNo(String orderNo);

    ArrayList<OrderTimeDto> checkOrderListByMySelfOrThird(HashMap<Object, Object> map);


    OrderDetailDto checkOrderList(String id);

    Order getOrderByOrderNo(String outTradeNo);

    ReceiverDto getRevicer(Long id);

    int updateStatus(@Param("id") Long id, @Param("status") Integer status, @Param("roleId") Integer roleId);

    List<Order> selectOrderStatusByCreateTime(@Param("status") Integer status, @Param("date") String date);

    List WXlistSellerOrders(@Param("status") Integer status, @Param("userId") Long userId);

    List<WxSelfBuyOrderDto> wxBuySellerOrders(@Param("status") Integer status, @Param("userId") Long userId);

    List<WxAskBuyOrderListDto> wxBuyListSellerOrders(@Param("status")Integer status,@Param("userId")Long userId);

    List WXselforder(@Param("status") Integer status, @Param("userId") Long userId, @Param("merchantId") Long merchantId);

    List<BigDecimal> getCountByMonthTime();


    Integer getRealOrderNum(Long merchantId);

    List<LogisticsCompanyDropDto> getLogisticsCompanyList();

    Order selectByPrimaryKeyAnduserId(@Param("id") Long id, @Param("userId") Long userId);

    /**
     * 获取微信小程序端求购个订单数据
     * @param userId 用户id
     * @return
     */
    List<WxSelfBuyOrderDto> getWxOrderByUserId(@Param("userId") Long userId,@Param("status") Integer status);

    /**
     * 获取微信小程序端求购订单里面列表数据
     * @param userId 用户id
     * @return
     */
    List<WxAskBuyOrderListDto> getWxAskBuyOrderListByUserId(@Param("userId") Long userId,@Param("status") Integer status);

    /**
     * 获取微信小程序端自营求购订单里面的详情数据
     * @param orderId 订单id
     * @return
     */
    WxOrderInformationDto getWxOrderInformationByOrderId(Long orderId);

    void updateStatusByIds(List<Long> list);

    /**
     * 根据用户id和订单id查询用户是否拥有该订单
     * @param userId
     * @param orderId
     * @return
     */
    Order getOrderByUserIdAndOrderId(@Param("userId") Long userId,@Param("orderId") Long orderId);

    OrderDetailDto WXcheckOrderList(Long orderId);

    Integer checkQuotationId(@Param("quotationId") Long quotationId);

    BuyerAndSellerDto getBuyerAndSellerById(@Param("id") Long id);

    /**
     * 根据报价id统计订单表
     * @param quotationId
     * @return
     */
    Integer getOrderByQuotationId(@Param("quotationId") Long quotationId);

    Integer getDayAskCountByUserId(Long userId);

    Integer getTotleAskCountByUserId(Long userId);
}